'use strict';
import jwt from 'jsonwebtoken';
export default class extends think.service.base {
    /**
     * init
     * @return {}         []
     */
    createToken(userinfo,secret) {
        let result = jwt.sign(userinfo, secret.secret);
        return result;
    }

    verifyToken(token,secret) {
        if (token) {
            try {
                let result = jwt.verify(token,secret.secret);
                return result;
            } catch (err) {
                return "fail";
            }
        }
        return "fail";
    }
}
